package ventanas.prueba;

import java.awt.Dimension;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.InputStream;
import java.sql.SQLException;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JPanel;

import logic.characters.Player;
import logic.pruebas.GamePanel;

import database.gestor.GestorBD;

public class VentanaJuego extends JFrame {

	private GamePanel panel;
	private Player player;


	public VentanaJuego(){
		this.setVisible(true);
		setSize(800,600);
		this.setPreferredSize(new Dimension (800,600));
		setResizable(false);	
		this.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
		this.setLocationRelativeTo(null);
		
		pack();

	}

	public JPanel getPanel(){
		return panel;
	}

	public void setPanel(JPanel p){
		panel.setVisible(false);
		p.setVisible(true);
		panel = (GamePanel)p;
	}

	public void setPlayer(Player p){
		player = p;
	}
	
	/**
	 * @author Unai
	 * Clase para el reconocimiento del pulsado de teclas
	 */
	private class TAdapter extends KeyAdapter{
		public void keyReleased(KeyEvent e){
			if(player!=null) {
				player.keyReleased(e);
			}
		}
		public void keyPressed(KeyEvent e){
			System.out.println("Pressed");
			if(player!=null) {
				player.keyPressed(e);
			}
		}
		
		
	}
}

